<?php
namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Routing\Controller as BaseController;
use Mail;

class MailController extends BaseController
{
    // 测试邮件发送模板
    public function send($core_id,$loop_name,$cable_temp,$fire,$smoke,$near_infrared,$location,$email_address) {
    	$name = 'yinni';
    	$flag = Mail::send('emails.test',['core_id' => $core_id,'loop_name' => $loop_name,
            'location' => $location,'cable_temp' => $cable_temp,'fire' => $fire,'smoke' => $smoke,'near_infrared' => $near_infrared
            ,'email_address' => $email_address],function($message){
    		$to = 'xuyiyepeng@126.com';

    		$message->to($to)->subject('新型智能消防物联网系统——报警通知');
    	});

    	// dump($flag);die;
    	// if($flag) {
    	// 	echo '邮件发送成功，请注意查收！';
    	// }else {
    	// 	echo "邮件发送失败，请检查错误日志！";
    	// }
    }
        public function sendemail() {
        $name = 'yinni';
        $flag = Mail::send('emails.test2',['name'=>$name],function($message){
            $to = 'xuyiyepeng@126.com';

            $message->to($to)->subject('新型智能消防物联网系统——报警通知');
        });
        // dd(Mail::failures());
    }
}
